<?php 
global $_GPC, $_W;
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$cfg = $this->module['config'];

if($operation=="checkupdate"){
    $shopid=$_GPC["shopid"];
    $item=pdo_fetch("SELECT * FROM ".tablename('j_hmoney_systemsetting')." order by id asc  limit 1");
    if(!$item)die(json_encode(array("success"=>false,"msg"=>"错误")));
    if(!$item['softurl'])die(json_encode(array("success"=>false,"msg"=>"暂无更新")));
    if(!file_exists("../attachment/j_hmoney/cert_2/".$item['softurl']))die(json_encode(array("success"=>false,"msg"=>"再无更新")));
    $url=urlencode($_W["siteroot"]."attachment/j_hmoney/cert_2/".$item['softurl']);
    $md5str=md5_file("../attachment/j_hmoney/cert_2/".$item['softurl']);
    die(json_encode(array("success"=>true,"softurl"=>$url,"softmd5"=>$md5str)));
}elseif($operation=="checkmemberupdate"){
    $userid=$_GPC["userid"];

    $item=pdo_fetch("SELECT * FROM ".tablename('j_hmoney_systemsetting')." order by id asc  limit 1");
    if(!$item)die(json_encode(array("success"=>false,"msg"=>"错误")));
    if(!$item['softmemberurl'])die(json_encode(array("success"=>false,"msg"=>"暂无更新")));
    if(!file_exists("../attachment/j_hmoney/cert_2/".$item['softmemberurl']))die(json_encode(array("success"=>false,"msg"=>"再无更新")));
    $url=urlencode($_W["siteroot"]."attachment/j_hmoney/cert_2/".$item['softmemberurl']);
    $md5str=md5_file("../attachment/j_hmoney/cert_2/".$item['softmemberurl']);
    die(json_encode(array("success"=>true,"softmemberurl"=>$url,"softmd5"=>$md5str)));

}
